package wahadlo.nowe.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class StandardModel implements Model, Serializable {

	private static final long serialVersionUID = 1L;

	private Map<String, Object> model;

	public StandardModel() {
		model = new HashMap<String, Object>();
	}

	public void add(String key, Object value) {
		model.put(key, value);
	}
	
	public void add(Model model) {
		this.addAll(model.getProperties());
	}
	
	@SuppressWarnings("unchecked")
	public void addAll(Map<? extends Object, ? extends Object> modelPart) {
		model.putAll((Map<String, Object>)modelPart);
	}

	public Map<Object, Object> getProperties() {
		return new HashMap<Object, Object>(model);
	}

}
